home *** CD-ROM | disk | FTP | other *** search
/ CD BIT 75 / CD BIT 75.iso / Software / ooo / f_0020 / sbasic.jar / text / sbasic / common / 03030206.xml < prev    next >
Encoding:
Extensible Markup Language  |  2003-08-01  |  5.9 KB  |  45 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>TimeValue Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03030206"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         span.T1{
  7.                 font-weight:bold;}
  8.         </style></head><body>
  9.   
  10.   
  11.   <help:paragraphinfo state="E" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="timevalue" xmlns:help="http://openoffice.org/2000/help"><a name="timevalue"/>
  12.   <p class="Head1"><help:paragraphinfo state="U" number="1"/><help:key-word value="TimeValue; function" tag="kw66550_1"/><help:link Id="66550">TimeValue Function [Runtime]</help:link></p>
  13.   <p class="Paragraph"><help:paragraphinfo state="U" number="2"/>Calculates a serial time value from the specified hour, minute, and second - parameters passed as strings - that represents the time in a single numeric value. This value can be used to calculate the difference between times.</p>
  14.   <help:paragraphinfo state="E"/></help:to-be-embedded>
  15.   <p class="Head2"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>Syntax:</p>
  16.   <p class="Paragraph"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>TimeValue (Text As String)</p>
  17.   <p class="Head2"><help:paragraphinfo state="U" number="5" xmlns:help="http://openoffice.org/2000/help"/>Return value:</p>
  18.   <p class="Paragraph"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/>Date</p>
  19.   <p class="Head2"><help:paragraphinfo state="U" number="7" xmlns:help="http://openoffice.org/2000/help"/>Parameters:</p>
  20.   <p class="Paragraph"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Text:</span> Any string expression that contains the time that you want to calculate in the format "HH:MM:SS".</p>
  21.   <p class="Paragraph"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/>Use the TimeValue function to convert any time into a single value, so that you can calculate time differences.</p>
  22.   <p class="Paragraph"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/>This TimeValue function returns the type Variant with VarType 7 (Date), and stores this value internally as a double-precision number between 0 and 0.9999999999.</p>
  23.   <p class="Paragraph"><help:paragraphinfo state="U" number="11" xmlns:help="http://openoffice.org/2000/help"/>As opposed to the DateSerial or the DateValue function, where serial date values result in days relative to a fixed date, you can calculate with the values that are returned by the TimeValue function, but you cannot evaluate them.</p>
  24.   <p class="Paragraph"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/>In the TimeSerial function, you can pass individual parameters (hour, minute, second) as separate numeric expressions. For the TimeValue function, however, you can pass a string as a parameter containing the time.</p>
  25.   <p class="Paragraph"><help:paragraphinfo state="S" xmlns:help="http://openoffice.org/2000/help"/><help:embedded Id="66475" Eid="errorcode" xmlns:help="http://openoffice.org/2000/help"/></p>
  26.   <p class="Paragraph"><help:paragraphinfo state="S" xmlns:help="http://openoffice.org/2000/help"/><help:embedded Id="66475" Eid="err5" xmlns:help="http://openoffice.org/2000/help"/></p>
  27.   <p class="Paragraph"><help:paragraphinfo state="S" xmlns:help="http://openoffice.org/2000/help"/><help:embedded Id="66475" Eid="err13" xmlns:help="http://openoffice.org/2000/help"/></p>
  28.   <p class="Head2"><help:paragraphinfo state="U" number="13" xmlns:help="http://openoffice.org/2000/help"/>Example:</p>
  29.   <p class="PropText"><help:paragraphinfo state="U" number="30" xmlns:help="http://openoffice.org/2000/help"/>Sub ExampleTimerValue</p>
  30.   <p class="PropText"><help:paragraphinfo state="U" number="31" xmlns:help="http://openoffice.org/2000/help"/>Dim daDT as Date</p>
  31.  
  32.   <p class="PropText"><help:paragraphinfo state="U" number="32" xmlns:help="http://openoffice.org/2000/help"/>Dim a1, b1, c1, a2, b2, c2 as String</p>
  33.   <p class="PropText"><help:paragraphinfo state="U" number="33" xmlns:help="http://openoffice.org/2000/help"/>a1 = "start time"</p>
  34.   <p class="PropText"><help:paragraphinfo state="U" number="34" xmlns:help="http://openoffice.org/2000/help"/>b1 = "end time"</p>
  35.   <p class="PropText"><help:paragraphinfo state="U" number="35" xmlns:help="http://openoffice.org/2000/help"/>c1 = "total time"</p>
  36.   <p class="PropText"><help:paragraphinfo state="U" number="36" xmlns:help="http://openoffice.org/2000/help"/></p>
  37.   <p class="PropText"><help:paragraphinfo state="U" number="37" xmlns:help="http://openoffice.org/2000/help"/>a2 = "8:34"</p>
  38.   <p class="PropText"><help:paragraphinfo state="U" number="38" xmlns:help="http://openoffice.org/2000/help"/>b2 = "18:12"</p>
  39.   <p class="PropText"><help:paragraphinfo state="U" number="39" xmlns:help="http://openoffice.org/2000/help"/>daDT = TimeValue(b2) - TimeValue(a2)</p>
  40.   <p class="PropText"><help:paragraphinfo state="U" number="40" xmlns:help="http://openoffice.org/2000/help"/>c2 = a1 & ": " & a2 & chr(13)</p>
  41.   <p class="PropText"><help:paragraphinfo state="U" number="41" xmlns:help="http://openoffice.org/2000/help"/>c2 = c2 & b1 & ": " & b2 & chr(13)</p>
  42.   <p class="PropText"><help:paragraphinfo state="U" number="42" xmlns:help="http://openoffice.org/2000/help"/>c2 = c2 & c1 & ": " & trim(Str(Hour(daDT))) & ":" & trim(Str(Minute(daDT))) & ":" & trim(Str(Second(daDT)))</p>
  43.   <p class="PropText"><help:paragraphinfo state="U" number="43" xmlns:help="http://openoffice.org/2000/help"/>Msgbox c2</p>
  44.   <p class="PropText"><help:paragraphinfo state="U" number="44" xmlns:help="http://openoffice.org/2000/help"/>end sub</p>
  45.  </body></html>